import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
  GetProcurementInfo = '/procurement-internal',
  GetPreview = '/procurement-internal/preview',
  AddInternal = '/procurement-internal',
  editInfo = '/procurement-internal',
  DelInfo = '/procurement-internal',
  Statsitic = '/procurement-internal/statsitic',
  // ImportLedger = '/ledger/project-ledger/import',
  // GetCompanyLedger = '/ledger/company-ledger',
  // GetProjectLedger = '/ledger/project-ledger',
  // GetCompanyList = '/company/name-list',
  // DelCompany = '/company/name-list',
  // AddCompany = '/company/name-list',
  // SearchCompany = '/company/search',
}

// 获取采购信息列表
export function getProcurementInfo(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.get(
    { url: Api.GetProcurementInfo, params },
    {
      errorMessageMode: mode,
    },
  );
}
// 获取采购预览信息
export function getPreview(mode: ErrorMessageMode = 'message') {
  return defHttp.get(
    { url: Api.GetPreview },
    {
      errorMessageMode: mode,
    },
  );
}
// 添加采购信息
export function addInternal(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: Api.AddInternal, params },
    {
      errorMessageMode: mode,
    },
  );
}
export function editInfo(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.put(
    { url: Api.editInfo, params },
    {
      errorMessageMode: mode,
    },
  );
}
// 删除采购信息
export function delInfo(id: any, mode: ErrorMessageMode = 'message') {
  return defHttp.delete(
    { url: Api.DelInfo + `/${id}` },
    {
      errorMessageMode: mode,
    },
  );
}
// 价格对比分析
export function statsitic(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.get(
    { url: Api.Statsitic, params },
    {
      errorMessageMode: mode,
    },
  );
}
